using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Acme.BookStore.Purchase.NotificationOrderD;
using Acme.BookStore.PurchaseDto.NotificationOrder;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace Acme.BookStore.HttpApi.Host.Controllers
{
    [RemoteService]
    [Route("api/notificationOrder")]
    [ApiController]
    public class NotificationOrderController : AbpController
    {
        private readonly INotificationOrderServices _notificationOrderService;

        public NotificationOrderController(INotificationOrderServices notificationOrderService)
        {
            _notificationOrderService = notificationOrderService;
        }

        [HttpGet("query")]
        public async Task<ListResultDto<NotificationOrderDto>> GetQueryAsync(
            [FromQuery] string notificationOrderNo = "",
            [FromQuery] string customerCode = "",
            [FromQuery] string customerName = "",
            [FromQuery] string notificationStatus = "",
            [FromQuery] string productCode = "",
            [FromQuery] string productName = "",
            [FromQuery] string customerOrderNo = "")
        {
            var queryDto = new NotificationOrderQueryDto
            {
                NotificationOrderNo = notificationOrderNo ?? string.Empty,
                CustomerCode = customerCode ?? string.Empty,
                CustomerName = customerName ?? string.Empty,
                NotificationStatus = notificationStatus ?? string.Empty,
                ProductCode = productCode ?? string.Empty,
                ProductName = productName ?? string.Empty,
                CustomerOrderNo = customerOrderNo ?? string.Empty
            };

            var result = await _notificationOrderService.QueryNotificationOrdersAsync(queryDto);
            return new ListResultDto<NotificationOrderDto>(result);
        }
    }
} 